//
//  HEIMGroupNotifCell.m
//  HealthElderly
//
//  Created by 吴欧 on 2021/11/22.
//  Copyright © 2021 honglutec. All rights reserved.
//

#import "HEIMGroupNotifCell.h"
#import "HEIMGroupNotifModel.h"

@interface HEIMGroupNotifCell ()

@property (nonatomic, strong) UILabel *titleLb;

@property (nonatomic, strong) UILabel *masterLb;

@property (nonatomic, strong) UILabel *dateLb;

@end

@implementation HEIMGroupNotifCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
 
        [self initUI];
    }
    return self;
}

- (void)initUI {
    _titleLb = [UILabel new];
    _titleLb.text = @"-";
    _titleLb.font = DYBlodFont(17);
    _titleLb.numberOfLines = 1;
    [self.contentView addSubview:_titleLb];
    
    _masterLb = [UILabel new];
    _masterLb.text = @"-";
    _masterLb.font = DYFont(17);
    _masterLb.numberOfLines = 1;
    _masterLb.textColor = KHexColor(@"#5e5e5e");
    [self.contentView addSubview:_masterLb];
    
    _dateLb = [UILabel new];
    _dateLb.text = @"-";
    _dateLb.font = DYFont(17);
    _dateLb.numberOfLines = 1;
    _dateLb.textAlignment = NSTextAlignmentRight;
    _dateLb.textColor = KHexColor(@"#5e5e5e");
    [self.contentView addSubview:_dateLb];
   
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(self.contentView).mas_offset(-15);
    }];
    
    [_masterLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(10);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(_dateLb.mas_left).mas_offset(-10);
        make.bottom.equalTo(self.contentView).mas_offset(-15);
    }];
    
    [_dateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(10);
        make.left.equalTo(_masterLb.mas_right).mas_offset(0);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.centerY.equalTo(_masterLb.mas_centerY);
    }];
    
    [_dateLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}

- (void)configCellWithModel:(HEIMGroupNotifModel *)model {
    _titleLb.text = model.notice_title;
    _masterLb.text = model.creator;
    _dateLb.text = model.gmt_create;
}

@end
